Skip to content

fix(parser): keep dkimVerdict and dmarcPolicy in SesReceipt - #8882

Open
dhaiirryyaa wants to merge 1 commit into
aws-powertools:developfrom
dhaiirryyaa:fix/parser-ses-receipt-dkim-dmarc
Open

dhaiirryyaa wants to merge 1 commit into
aws-powertools:developfrom
dhaiirryyaa:fix/parser-ses-receipt-dkim-dmarc

Conversation

@dhaiirryyaa

Copy link
Copy Markdown
Contributor

Issue number: closes #8880

Summary

Changes

  • In aws_lambda_powertools/utilities/parser/models/ses.py:
    • Added optional fields dkimVerdict: SesReceiptVerdict | None = None and dmarcPolicy: Literal["none", "quarantine", "reject"] | None = None to SesReceipt.
  • In tests/unit/parser/_pydantic/test_ses.py:
    • Added assertions in test_ses_trigger_event verifying receipt.dkimVerdict and receipt.dmarcPolicy are preserved from inbound SES event fixtures.
    • Added unit test test_ses_trigger_event_without_dkim_verdict_and_dmarc_policy verifying backward compatibility when SES events omit dkimVerdict and dmarcPolicy.

User experience

  • Inbound SES events parsed with SesModel now preserve receipt.dkimVerdict (with status PASS, FAIL, GRAY, or PROCESSING_FAILED) and receipt.dmarcPolicy (none, quarantine, reject), matching the TypeScript parser schema and Powertools Python's SESEvent data class.
  • Lambda functions handling SES receipt events can inspect receipt.dkimVerdict.status and receipt.dmarcPolicy directly from the parsed model to filter spam or enforce security policies.

Verification

  • Ran reproduction test proving dkimVerdict and dmarcPolicy were previously dropped.
  • Ran pytest tests/unit/parser/_pydantic/test_ses.py (8 passed, 100% coverage on ses.py).
  • Ran full parser test suite pytest tests/unit/parser tests/functional/parser (274 passed, 0 failures).
  • Ran ruff check, ruff format --check, and mypy (clean, 0 errors).

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dhaiirryyaa
dhaiirryyaa requested a review from a team as a code owner November 21, 2026 07:46
@dhaiirryyaa
dhaiirryyaa requested a review from svozza November 21, 2026 07:46
@boring-cyborg boring-cyborg Bot added the tests label Nov 21, 2026
@powertools-for-aws-oss-automation powertools-for-aws-oss-automation Bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Nov 21, 2026
@sonarqubecloud

Copy link
Copy Markdown

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: SesModel drops dkimVerdict and dmarcPolicy from the receipt

1 participant